import Axios from './axios';

// 设置全局授权请求头
const setAuth = (token) => {
    const headers = Axios.defaults.headers;
    // 开发环境发送模拟用户ID
    if (typeof token === 'string') {
        Axios.defaults.isSetAuth = true;
        headers['Authorization'] = token;
    } else {
        Axios.defaults.isSetAuth = false;
        delete headers['Authorization'];
    }
    Axios.defaults.headers = headers;
};

export default {
    setAuth
};
